'use client'

import {Checkbox, GetProp} from "antd";
import {QuestionBankItemVo} from "@/types";

function CheckboxTpl({items, onChange}: {items: QuestionBankItemVo[], onChange: any}) {

  const options = items.map(i => {
    return {
      label: i.optionId,
      value: i.optionValue
    }
  })

  const onChangeCheckbox: GetProp<typeof Checkbox.Group, 'onChange'> = (checkedValues) => {
    onChange(checkedValues)
  }

  return (
    <Checkbox.Group options={options} onChange={onChangeCheckbox} />
  )
}

export default CheckboxTpl
